Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Add best practices field to block config and get blocks metadata tool to give more context on Sim-native core blocks.

Type of Change

  • Other: Copilot Context Improvement

Testing

Manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel vercel bot temporarily deployed to Preview – docs September 23, 2025 19:19 Inactive
@vercel
Copy link

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Error Error Sep 23, 2025 8:09pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 23, 2025 8:09pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR enhances the Sim platform's copilot capabilities by adding contextual best practices to all block configurations. The implementation adds a new optional bestPractices field to the BlockConfig interface and populates it across 15+ core workflow blocks including Agent, API, Function, Memory, and various triggers.

Key Changes:

  • Type System: Added optional bestPractices?: string field to BlockConfig interface in types.ts
  • Block Configurations: Each block now includes tailored guidance covering common usage patterns, gotchas, and recommendations
  • Metadata Tool: Updated get-blocks-metadata-tool.ts to extract and expose best practices through the copilot's metadata API
  • Special Blocks: Added best practices for loop and parallel control flow blocks in the metadata tool

Best Practices Content Quality:

  • Agent Block: Comprehensive guidance on tool restrictions, YAML syntax, and response format usage
  • Function Block: Clear direction on execution modes (remote vs local) and variable referencing
  • API Trigger: Detailed examples including production curl commands and variable access patterns
  • Memory Block: Integration guidance with agent blocks for conversation persistence

The implementation follows a consistent pattern across all blocks, providing practical, actionable guidance that will help the copilot provide better contextual assistance to users building workflows.

Confidence Score: 4/5

  • This PR is safe to merge with minor text corrections needed
  • Score reflects clean type system changes and comprehensive documentation additions. Only minor typos in memory block prevent a perfect score. The implementation is consistent, follows established patterns, and enhances user experience without introducing breaking changes.
  • apps/sim/blocks/blocks/memory.ts contains typos that should be fixed

Important Files Changed

File Analysis

Filename        Score        Overview
apps/sim/blocks/types.ts 5/5 Added optional bestPractices field to BlockConfig interface - clean type definition change
apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts 5/5 Updated metadata tool to include bestPractices in CopilotBlockMetadata interface and added to metadata extraction logic
apps/sim/blocks/blocks/agent.ts 5/5 Added comprehensive best practices for Agent blocks covering tool usage, custom tools YAML syntax, and response format
apps/sim/blocks/blocks/function.ts 5/5 Added detailed best practices for Function block covering Python/JavaScript execution modes and variable referencing
apps/sim/blocks/blocks/memory.ts 3/5 Added best practices for Memory block with YAML syntax guidance and agent integration, but contains typos
apps/sim/blocks/blocks/api_trigger.ts 5/5 Added comprehensive best practices for API trigger including manual testing, variable access patterns, and production curl examples

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant UI as Sim UI
    participant Copilot as Copilot Agent
    participant MetadataTool as get-blocks-metadata-tool
    participant BlockRegistry as Block Registry
    participant BlockConfig as Block Configuration

    Note over Dev,BlockConfig: PR #1427: Adding Best Practices to Block Configs

    Dev->>BlockConfig: Add bestPractices field to BlockConfig interface
    Dev->>BlockConfig: Implement bestPractices in all 15+ block definitions
    
    Note over BlockConfig: Each block now includes contextual guidance:<br/>- Agent: tool usage, YAML syntax<br/>- API: endpoint testing recommendations<br/>- Function: execution mode guidance<br/>- Memory: integration with agents<br/>- etc.

    Dev->>MetadataTool: Update CopilotBlockMetadata interface
    Dev->>MetadataTool: Add bestPractices extraction logic
    Dev->>MetadataTool: Add bestPractices for loop/parallel special blocks

    Note over UI,Copilot: Runtime: Enhanced Copilot Context

    UI->>Copilot: User requests workflow assistance
    Copilot->>MetadataTool: get_blocks_metadata(blockIds)
    MetadataTool->>BlockRegistry: Retrieve block configurations
    BlockRegistry-->>MetadataTool: Block configs with bestPractices
    MetadataTool-->>Copilot: Enhanced metadata including best practices
    Copilot->>UI: Provide contextual guidance using best practices
Loading

17 files reviewed, 2 comments

Edit Code Review Bot Settings | Greptile

icecrasher321 and others added 2 commits September 23, 2025 12:22
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@icecrasher321 icecrasher321 changed the title improvement(copilot): add best practices for blocks improvement(copilot): add best practices for core blocks Sep 23, 2025
@vercel vercel bot temporarily deployed to Preview – docs September 23, 2025 19:26 Inactive
@vercel vercel bot temporarily deployed to Preview – docs September 23, 2025 19:59 Inactive
@vercel vercel bot temporarily deployed to Preview – docs September 23, 2025 20:03 Inactive
@icecrasher321 icecrasher321 merged commit fbb164d into staging Sep 23, 2025
5 of 6 checks passed
waleedlatif1 pushed a commit that referenced this pull request Sep 23, 2025
* improvement(copilot): add best practices for blocks

* fix kb, api

* Update apps/sim/blocks/blocks/memory.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* address comments

* remove non deterministic test

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@waleedlatif1 waleedlatif1 deleted the improvement/best-prac-meta branch October 7, 2025 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants